package cn.zhentao.service.Impl;

import cn.zhentao.dao.PetDao;
import cn.zhentao.dao.ZhDao;
import cn.zhentao.pojo.Pet;
import cn.zhentao.pojo.User;
import cn.zhentao.service.PetService;
import cn.zhentao.vo.ZhVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.Serializable;
import java.util.List;
@Service
public class PetServiceImpl implements PetService {
   @Autowired
   private PetDao petDao;
   @Autowired
   private ZhDao zhDao;
    @Override
    public void addpet(Pet pet) {
        petDao.addpet(pet);
//        User findo = petDao.findo(zhVo.getUid());
//        Integer uid = zhVo.getUid();
//        zhVo.setUid(uid);
    }

    @Override
    public int updatep(Pet pet) {
        int updatep = petDao.updatep(pet);
        return updatep;
    }

    @Override
    public int update(Integer pid,Integer pill,Integer uid) {
        int update = petDao.update(pid,pill);
        zhDao.addm(uid);
        return 1;
    }

    @Override
    public List<Pet> findp(String pname) {
        List<Pet> findp = petDao.findp(pname);
        return findp;
    }

    @Override
    public int delp(Integer [] uid) {
        int a=0;
        for (Integer i : uid) {
        a=petDao.delp(i);
        }
        return a;
    }

    @Override
    public int del(Integer uid) {
        int del = petDao.del(uid);
        return del;
    }

    @Override
    public List<Pet> finmo(String pname) {
        List<Pet> finmo = petDao.finmo(pname);
        return finmo;
    }

    @Override
    public List<Pet> findz(Integer uid) {
        List<Pet> findz = petDao.findz(uid);
        return findz;
    }
}
